home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Eclipse SDK / eclipse-SDK-3.1.1-win32.exe / eclipse / plugins / org.eclipse.help.webapp_3.1.0 / advanced / contentActions.js < prev    next >
Encoding:
JavaScript  |  2005-09-29  |  3.6 KB  |  126 lines

  1. /*******************************************************************************
  2.  * Copyright (c) 2000, 2004 IBM Corporation and others.
  3.  * All rights reserved. This program and the accompanying materials 
  4.  * are made available under the terms of the Eclipse Public License v1.0
  5.  * which accompanies this distribution, and is available at
  6.  * http://www.eclipse.org/legal/epl-v10.html
  7.  * 
  8.  * Contributors:
  9.  *     IBM Corporation - initial API and implementation
  10.  *******************************************************************************/
  11.  
  12. var isMozilla = navigator.userAgent.indexOf('Mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
  13. var isIE = navigator.userAgent.indexOf('MSIE') != -1;
  14.  
  15. var navVisible = true;
  16.     
  17. function goBack(button) {
  18.     parent.history.back();
  19.     if (isIE && button && document.getElementById(button)){
  20.         document.getElementById(button).blur();
  21.     }
  22. }
  23.  
  24. function goForward(button) {
  25.     parent.history.forward();
  26.     if (isIE && button && document.getElementById(button)){
  27.         document.getElementById(button).blur();
  28.     }
  29. }
  30.  
  31.  
  32. function bookmarkPage(button)
  33. {
  34.     // Currently we pick up the url from the content page.
  35.     // If the page is from outside the help domain, a script
  36.     // exception is thrown. We need to catch it and ignore it.
  37.     try
  38.     {
  39.         // use the url from plugin id only
  40.         var url = parent.ContentViewFrame.location.href;
  41.         var i = url.indexOf("/topic/");
  42.         if (i >=0 )
  43.             url = url.substring(i+6);
  44.         // remove any query string
  45.         i = url.indexOf("?");
  46.         if (i >= 0)
  47.             url = url.substring(0, i);
  48.             
  49.         var title = parent.ContentViewFrame.document.title;
  50.         if (title == null || title == "")
  51.             title = url;
  52.  
  53.         /********** HARD CODED VIEW NAME *************/
  54.         parent.parent.NavFrame.ViewsFrame.bookmarks.bookmarksViewFrame.location.replace("bookmarksView.jsp?operation=add&bookmark="+encodeURIComponent(url)+"&title="+encodeURIComponent(title));
  55.     }catch (e) {}
  56.     if (isIE && button && document.getElementById(button)){
  57.         document.getElementById(button).blur();
  58.     }
  59. }
  60.  
  61. function bookmarkInfocenterPage(button)
  62. {
  63.     // Currently we pick up the url from the content page.
  64.     // If the page is from outside the help domain, a script
  65.     // exception is thrown. We need to catch it and ignore it.
  66.     try
  67.     {
  68.         // use the url from plugin id only
  69.         var url = parent.ContentViewFrame.location.href;
  70.         var i = url.indexOf("/topic/");
  71.         if (i >=0 )
  72.             url = url.substring(i+6);
  73.         // remove any query string
  74.         i = url.indexOf("?");
  75.         if (i >= 0)
  76.             url = url.substring(0, i);
  77.             
  78.         var title = parent.ContentViewFrame.document.title;
  79.         if (title == null || title == "")
  80.             title = url;
  81.  
  82.         /********** HARD CODED VIEW NAME *************/
  83.         window.external.AddFavorite(parent.ContentViewFrame.location.href,title);
  84.     }catch (e) {}
  85.     if (isIE && button && document.getElementById(button)){
  86.         document.getElementById(button).blur();
  87.     }
  88. }
  89.  
  90. function resynch(button)
  91. {
  92.     try {
  93.         var topic = parent.ContentViewFrame.window.location.href;
  94.         // remove the query, if any
  95.         var i = topic.indexOf('?');
  96.         if (i != -1)
  97.             topic = topic.substring(0, i);
  98.         parent.parent.NavFrame.displayTocFor(topic);
  99.     } catch(e) {}
  100.     if (isIE && button && document.getElementById(button)){
  101.         document.getElementById(button).blur();
  102.     }
  103. }
  104.  
  105. function printContent(button)
  106. {
  107.     try {
  108.         parent.ContentViewFrame.focus();
  109.         parent.ContentViewFrame.print();
  110.     } catch(e) {}
  111.     if (isIE && button && document.getElementById(button)){
  112.         document.getElementById(button).blur();
  113.     }
  114. }
  115.  
  116. function setTitle(label)
  117. {
  118.     if( label == null) label = "";
  119.     var title = document.getElementById("titleText");
  120.     if(title !=null){
  121.         var text = title.lastChild;
  122.         text.nodeValue = " "+label;
  123.     }
  124. }
  125.  
  126.